package main

import (
	"fmt"
	"git.inke.cn/bpc/framework/server/utils/structs"
	"git.inke.cn/chat11/server/chatright/util"
	"time"
)

type RingBackVideoModel struct {
	ID          int64     `gorm:"column:id" json:"id,omitempty"` //omitempty无效
	Uid         int64     `gorm:"column:uid" json:"uid,omitempty"`
	VideoID     int64     `gorm:"column:video_id" json:"video_id"`
	VideoURL    string    `gorm:"column:video_url" json:"video_url"`
	CoverURL    string    `gorm:"column:cover_url" json:"cover_url"`
	PreVideoID  int64     `gorm:"column:pre_video_id" json:"pre_video_id"`
	PreVideoURL string    `gorm:"column:pre_video_url" json:"pre_video_url"`
	PreCoverURL string    `gorm:"column:pre_cover_url" json:"pre_cover_url"`
	UploadType  int       `gorm:"column:upload_type" json:"upload_type"`
	CreateTime  time.Time `gorm:"column:create_time" json:"-"` //这里标记了“-”就没有这个字段
	UpdateTime  time.Time `gorm:"column:update_time" json:"update_time,omitempty"`
}

func main() {
	d := RingBackVideoModel{
		ID:          0,
		Uid:         0,
		VideoID:     11,
		VideoURL:    "22",
		CoverURL:    "33",
		PreVideoID:  0,
		PreVideoURL: "",
		PreCoverURL: "",
		UploadType:  0,
		CreateTime:  time.Now(), //这个无法转换
		UpdateTime:  time.Now(),
	}
	r, _ := structs.Struct2Map(d)
	fmt.Println(util.StructToJson(r))
}
